package WaiBao;

import java.util.Arrays;

public class ChenYuQi {
    public static void main(String[] args) {
        String[] name = {"张小红(班长)", "王志宇(副班长)", "小李(学习委员)", "李唐(纪律委员)", "高见鸿", "刘勋", "李勋", "唐嫣", "张菲菲", "王志航", "李金航", "张学友",
                "张型号", "王局", "李凯", "王子文", "李凯子", "王兆轩", "王霍邱", "离开之", "王航", "李志豪", "刘云峰", "王太阳", "李向阳", "荔枝纹", "王也", "李开智",
                "杨浩楠", "陈宇琦(学生)"};//考生本人:陈宇琦(学生)
        int[] age = {20, 22, 20, 18, 21, 20, 19, 20, 20, 18, 18, 20, 21, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 20, 20, 20, 21, 20};//考生本人年龄:20



        double[] duli1 = {76, 64, 86, 91, 91, 77, 78, 85, 81, 91, 71, 87, 86, 79, 65, 74, 84, 90, 86, 88, 92, 91, 75, 65, 75, 74, 92, 84, 84, 97};
        double[] duli2 = {88, 75, 75, 79, 85, 68, 87, 64, 78, 84, 91, 77, 78, 84, 84, 65, 76, 69, 76, 68, 72, 71, 96, 86, 74, 84, 84, 65, 71, 95};
        double[] duli3 = {67, 61, 84, 85, 75, 64, 78, 69, 80, 80, 93, 87, 85, 65, 65, 68, 65, 66, 96, 93, 62, 81, 65, 65, 76, 84, 75, 71, 84, 96};


        double gagei1 ;//代表每个学生的总分
        double gagei2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            gagei1  = duli1[i] +duli2[i] + duli3[i];
//            gagei2 = (gagei1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + gagei1);
//            System.out.println(name[i] + "的平均分为:" + gagei2);
//        }


        double shailuo1 = 0,shailuo2 = 0;
        double[] green = new double[30];
//        for (int i = 0; i < 30; i++) {
//            shailuo1=duli1[i] + duli2[i] + duli3[i];
//            shailuo2 = (shailuo1* 1.0) / 3;
//            green[i] = shailuo2;
//        }
//
//        for (int i = 0; i <green.length - 1; i++) {
//            for (int j = 0; j <green.length - i - 1; j++) {
//                if (green[j] <green[j + 1]) {
//                    double tep = green[j];
//                    green[j] = green[j + 1];
//                    green[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println( green[i]);
//        }



        double pink1 = 0, pink2 = 0,pink3 = 0;//计算每门课的平均分
        double zhao1 = 0, zhao2 = 0, zhao3 = 0;//计算每门课标准差
        double kuang1 = 0, kuang2 = 0, kuang3 = 0;//计算每门课中位数
        double he = 0;
        for (int i = 0; i < duli1.length; i++) {
            he +=duli1[i];
        }
        pink1 = (he * 1.0) / 30;
        System.out.println("农业设施及环境调控的班级平均分为:" + pink1);
        double Sum = 0;
        for (int i = 0; i < duli2.length; i++) {
            Sum +=duli2[i];
        }
        pink2 = (Sum * 1.0) / 30;
        System.out.println("农业设施设计与建造的班级平均分为:" + pink2);
        double sum = 0;
        for (int i = 0; i <duli3.length; i++) {
            sum +=duli3[i];
        }
        pink3 = (sum * 1.0) / 30;
        System.out.println("园艺植物设施栽培学的班级平均分为:" + pink3);



        double c1 = 0, c2 = 0, c3 = 0;
        for (int i = 0; i <duli1.length; i++) {
            c1 += (duli1[i] - pink1) * (duli1[i] - pink1);
        }
        zhao1 = Math.sqrt(c1*1.0/30);
        System.out.println("农业设施及环境调控的班级标准差为:" + zhao1);
        for (int i = 0; i < duli2.length; i++) {
            c2 += (duli2[i] - pink2) * (duli2[i] -pink2);
        }
        zhao2 = Math.sqrt(c2*1.0/30);
        System.out.println("农业设施设计与建造的班级标准差为:" +zhao2);

        for (int i = 0; i <duli3.length; i++) {
            c3 += (duli3[i] -pink3) * (duli3[i] -  pink3);
        }
        zhao3 = Math.sqrt(c3*1.0/30);
        System.out.println("园艺植物设施栽培学的标准差为:" + zhao3);
////////////
        Arrays.sort(duli1);
        Arrays.sort(duli2);
        Arrays.sort(duli3);
        kuang1 = (duli1[15] +duli2[14]) * 1.0 / 2;
        kuang2 = (duli2[15] +duli2[14]) * 1.0 / 2;
        kuang3 = (duli3[15] +duli3[14]) * 1.0 / 2;
        System.out.println("农业设施及环境调控的中位数为:" + kuang1);
        System.out.println("农业设施设计与制造的中位数为:" + kuang2);
        System.out.println("园艺植物设施栽培学的中位数为:" + kuang3);



    }
}
